$function util:toggle_score {name:$(name),scoreboard:$(scoreboard)}

$execute if score $(name) $(scoreboard) matches 1 run tellraw @a [{"text": "游戏规则","color": "yellow"},$(display),{"text": "已开启!","color":"green"}]
$execute if score $(name) $(scoreboard) matches 0 run tellraw @a [{"text": "游戏规则","color": "yellow"},$(display),{"text": "已关闭","color":"red"}]

playsound minecraft:block.note_block.hat master @a 0 0 0 99999999 1
$execute if score $(name) $(scoreboard) matches 1 as @a at @s run playsound minecraft:entity.generic.explode master @a ~ ~ ~ 0.3 1